/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ru.jSky.factory;

import java.util.Collection;
import org.hamcrest.Matcher;
import ru.jSky.matcher.AnyFromCollectionMatcher;
import ru.jSky.matcher.MatcherAdapter;
import ru.jSky.producer.Producer;

/**
 *
 * @author Rakev
 */
public class AdapterMatcherFactory {

    private static AdapterMatcherFactory matcherAdapterFactory = new AdapterMatcherFactory();

    public static AdapterMatcherFactory create() {
        return matcherAdapterFactory;
    }

    protected AdapterMatcherFactory() {
    }

    public <F, T> Matcher<F> create(Producer<F, T> producer, Matcher<T> matcher) {
        return new MatcherAdapter<>(producer, matcher);
    }

    public <F, C extends Collection<E>, E> Matcher<F> createAnyOf(Producer<F, C> producer, Matcher<E> matcher) {
        Matcher<C> collectionMatcher = new AnyFromCollectionMatcher<>(matcher);
        return create(producer, collectionMatcher);
    }
}
